﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace MDIDemo.Windows
{
    public partial class frmDate : DevExpress.XtraEditors.XtraForm
    {
        public frmDate()
        {
            InitializeComponent();
        }

        private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
        {
            dateEdit1.EditValue = e.Start;
        }
        DateTime ReturnValue = DateTime.Today;
        private void btnDongY_Click(object sender, EventArgs e)
        {
            if (dateEdit1.EditValue != null)
                ReturnValue = Convert.ToDateTime(dateEdit1.EditValue);
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            Close();
        }

        public DateTime SelectedDate
        {
            get { return ReturnValue; }
            set
            {
                monthCalendar1.SelectionStart = value;
                monthCalendar1.SelectionEnd = value;
                dateEdit1.EditValue = value;
            }
        }
    }
}